package com.cloud.shopping.user.controller;

import com.cloud.shopping.tool.RespResult;
import com.cloud.shopping.user.model.Address;
import com.cloud.shopping.user.service.AddressService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author John.zhang
 * @version Id: AddressController, v 1.0 2021/1/3 21:05 ZhiYong Exp $
 */

@RestController
@RequestMapping(value = "/address")
@CrossOrigin
public class AddressController {

    @Resource
    private AddressService addressService;

    /**
     * 用户收件地址列表
     *
     * @return List<Address>
     */
    @GetMapping(value = "/list")
    public RespResult<List<Address>> list() {
        String userName = "John";
        List<Address> list = addressService.list(userName);
        return RespResult.ok(list);
    }
}
